@extends('common.base-master')

@section('html-title')
    <title>论坛</title>
@endsection

@section('html-head')
    <link rel="stylesheet" href="{{url('css/public.css')}}">
    <link rel="stylesheet" href="{{url('css/common.css')}}">
    <link rel="stylesheet" href="{{url('forum_tmp/reset.css')}}">
    <link rel="stylesheet" href="{{url('forum_tmp/global.css')}}">
    <style>
        body{
            background-color: #f4f4f4;
        }
        .indexTable a{
            text-decoration: none;
        }
        .indexTable li a{
            color: #999;
        }
        .indexTable li.on a{
            color:#289fff;
        }
    </style>
@endsection

@section('html-body')
    <div class="indexTable">
        <ul>
            <li @if($type == "hot")class="on"@endif><a href="{{route('Home.Page.forumHome')}}?type=hot">热门</a></li>
            <li @if($type == "new")class="on"@endif><a href="{{route('Home.Page.forumHome')}}?type=new">最新</a></li>
            <li @if($type == "essence")class="on"@endif><a href="{{route('Home.Page.forumHome')}}?type=essence">精华</a></li>
        </ul>
    </div>
    <div style="width: 100%;height: 40px"></div>
    <div class="indexTable_con" style="display: block">
        @if(!is_null($forums) && count($forums) > 0)
            @foreach($forums as $forum)
        <div class="indexTable_son">
                <div class="indexTable_sonHead">
                    <div class="inHeadPic">
                        <img src="{{$forum->user_info->photo_url}}" alt="">
                    </div>
                    <p>{{$forum->user_info->nickname}}</p>
                    @if($forum->is_essence == 1)
                    <span>精华</span>
                    @endif
                </div>
            <a href="{{route('Home.Page.forumDetail')}}?id={{$forum->id}}">
                <img src="{{$forum->img_url}}" style="width: 100%;margin-top: 10px" />
                <div class="indexTableCon">
                    <h1>{{$forum->title}}</h1>
                    <p>{{$forum->desc}}</p>
                </div>
            </a>
            <ul class="indexTable_conFoot clearfix">
                <li>评论<span>{{$forum->discuss_count}}</span></li>
                <li>查看<span>{{$forum->read_num}}</span></li>
                <li>{{\App\Http\Services\Tools::simpleTimestamp(strtotime($forum->created_at))}}</li>
            </ul>
        </div>
            @endforeach
            @endif
    </div>
    <div style="width: 100%;height: 50px"></div>

    @include('common.new-menu')
    <script>
        $(".indexTable li").click(function(){
            var indexs=$(this).index();
            $(".indexTable li").removeClass("on").eq(indexs).addClass("on");
            $(".indexTable_con").hide().eq(indexs).show();
        })
    </script>
@endsection